package com.probiz.estore.core.datasource;

import org.apache.commons.lang.StringUtils;

public class DbContextHolder {
	private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();   
	   
    public synchronized static void setDbType(String dbType) {   
    	synchronized(DbContextHolder.class){
    		if(StringUtils.isNotBlank(dbType) 
    				&& !dbType.equalsIgnoreCase(DbContextHolder.getDbType()))
    		contextHolder.set(dbType);   
    	}
    }   
  
    public static String getDbType() {   
        return  contextHolder.get();   
    }   
  
    public static void clearDbType() {   
        contextHolder.remove();
    }   

}
